<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{main::head}">
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div class="container-fluid">
    <form class="row g-3" th:object="${examPaper}">
        <div class="col-12">
            <input type="hidden" name="id_paper" th:value="*{id_paper}">
            <label for="inputAddress" class="form-label">试卷名</label>
            <input type="text" class="form-control" id="inputAddress" name="paper_name" th:value="*{paper_name}">
        </div>
        <div class="col-md-4">
            <label for="inputState" class="form-label">试卷类型</label>
            <select id="inputState" class="form-select" name="paper_type">
                <option value="4" th:selected="*{paper_type==4}">限时任务试卷（学生在时间段内考试）</option>
                <option value="2" th:selected="*{paper_type==2}">定时任务试卷（学生定时考试）</option>
                <option value="1" th:selected="*{paper_type==1}">普通任务试卷（学生在截止时间前完成考试）</option>
            </select>
        </div>
        <div class="col-md-6">
            <label class="form-label">所属班级</label>
            <select class="form-select" th:name="id_class">
                <option selected th:each="cls:${teacher.classesList}" th:text="${cls.class_name} + ${cls.class_number}"
                        th:selected="${*{id_class}==${cls.id_class}}" th:value="${cls.id_class}">
                    ...
                </option>
            </select>
        </div>
        <div class="col-md-6">
            <label class="form-label">开始日期</label>
            <input type="date" class="form-control" th:value="${#dates.format(examPaper.limit_start_time,'yyyy-MM-dd')}" th:name="start_day">
        </div>
        <div class="col-md-6">
            <label class="form-label">时间</label>
            <input type="time" class="form-control" th:value="${#dates.format(examPaper.limit_start_time,'hh:mm')}" th:name="start_time">
        </div>

        <div class="col-md-6">
            <label class="form-label">结束日期</label>
            <input type="date" class="form-control" th:value="${#dates.format(examPaper.limit_end_time,'yyyy-MM-dd')}" th:name="end_day">

        </div>
        <div class="col-md-6">
            <label class="form-label">时间</label>
            <input type="time" class="form-control" th:value="${#dates.format(examPaper.limit_end_time,'hh:mm')}" th:name="end_time">
        </div>
        <div class="col-12">
            <label for="inputAddress2" class="form-label">建议时间</label>
            <input type="text" class="form-control" id="inputAddress2"
                   name="suggest_time" th:value="*{suggest_time}">
        </div>
        <div class="col-12">
            <div class="form-check">
                <a class="btn bg-info" th:href="'questions-for-add/'+*{id_paper}">添加考题</a><span>共 <span th:text="*{question_count}">0</span> 道题。</span>
                <script th:if="${integer}">
                    window.alert("添加成功")
                </script>
            </div>
        </div>
        <div class="col-12">
            <button type="submit" class="btn btn-primary" onclick="form.action='change-exam-paper';form.submit();" th:if="*{id_paper}">保存</button>
            <button type="submit" class="btn btn-primary" onclick="form.action='new-exam-paper';form.submit();">保存为新试卷</button>
            <button type="reset" class="btn btn-secondary">重置</button>
        </div>
    </form>
</div>

</body>
</html>